import {
  MongooseModule,
  Prop,
  Schema,
  SchemaFactory
} from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { ShareDocument } from '../document/share.document';

export type WebsiteTypesDocument = WebsiteTypes & Document;

@Schema()
export class WebsiteTypes extends ShareDocument {
  // 网站类型名称
  @Prop({
    unique: true,
    required: true,
  })
  name: string;

  @Prop({
    default: ''
  })
  description: string;
}

export const WebsiteTypesSchema = SchemaFactory.createForClass(WebsiteTypes);

WebsiteTypesSchema.set('toJSON', { getters: true });

export const WebsiteTypesMongooseModule = MongooseModule.forFeature([
  { name: WebsiteTypes.name, schema: WebsiteTypesSchema },
]);
